package com.zzyl.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zzyl.base.PageResponse;
import com.zzyl.entity.NursingPlan;
import com.zzyl.mapper.NursingPlanMapper;
import com.zzyl.service.NursingPlanService;
import com.zzyl.vo.NursingPlanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NursingPlanServiceImpl implements NursingPlanService {

    @Autowired
    private NursingPlanMapper nursingPlanMapper;

    //护理计划分页查询
    @Override
    public PageResponse<NursingPlanVo> getByPage(String name, Integer status, Integer pageNum, Integer pageSize) {
        //1、开启分页插件
        PageHelper.startPage(pageNum,pageSize);
        //2、查询
        Page<NursingPlan> nursingPlanPage = nursingPlanMapper.selectByPage(name,status);
        PageResponse<NursingPlanVo> nursingPlanVoPageResponse = PageResponse.of(nursingPlanPage, NursingPlanVo.class);
        return nursingPlanVoPageResponse;
    }
}
